<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>准备界面</title>
    <style type="text/css">
        body {
            font-family: Arial, sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            background-color: #f8f9fa; /* 更浅的灰色背景 */
            margin: 0;
            position: relative;
        }

        .top-nav {
            position: absolute;
            top: 20px;
            right: 20px;
            font-size: 18px;
        }

        .top-nav a {
            color: #007bff; /* 更深的蓝色 */
            text-decoration: none;
            font-weight: bold;
            padding: 10px 20px; /* 增加内边距 */
            border-radius: 8px; /* 圆角 */
            transition: all 0.3s ease;
            background-color: rgba(255, 255, 255, 0.9); /* 半透明背景 */
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 阴影效果 */
        }

        .top-nav a:hover {
            color: white;
            background-color: #0056b3; /* 更深的蓝色背景 */
            text-decoration: none;
        }

        .container {
            text-align: center;
            background: #000;
            padding: 20px;
            border-radius: 15px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            width: 90vw;
            max-width: 1000px;
            margin-top: 20px;
            box-sizing: border-box;
            display: flex;
            flex-direction: column; /* 垂直排列 */
            gap: 20px; /* 设置元素之间的间距 */
        }

        .image-wrapper img {
            width: 100%;
            height: auto;
            object-fit: cover;
            border-radius: 10px;
        }

        .player {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px; /* 设置内部元素之间的间距 */
        }

        .player p {
            font-size: 18px;
            margin: 0;
            color: #fff; /* 白色文字 */
        }

        button {
            padding: 15px 30px;
            font-size: 18px;
            cursor: pointer;
            border: none;
            background: linear-gradient(135deg, #007bff, #0056b3); /* 渐变背景 */
            color: white;
            border-radius: 8px;
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 阴影效果 */
        }

        button:hover {
            background: linear-gradient(135deg, #0056b3, #004080); /* 更深的渐变背景 */
            transform: scale(1.05);
        }

        #player1Status, #player2Status {
            font-size: 16px;
            color: #0f0; /* 绿色文字 */
            display: flex;
            align-items: center;
            gap: 5px; /* 图标和文字之间的间距 */
        }

        #player1Status::before, #player2Status::before {
            content: "●";
            font-size: 12px;
            color: inherit;
            animation: pulse 1s infinite; /* 添加脉冲动画 */
        }

        @keyframes pulse {
            0% { opacity: 1; }
            50% { opacity: 0.5; }
            100% { opacity: 1; }
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .container {
                padding: 15px;
            }

            button {
                padding: 12px 24px;
                font-size: 16px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="top-nav">
            <a href="登录界面.html">返回</a>
        </div>
        <div class="player">
            <p>玩家1:</p>
            <button id="player1ReadyBtn">准备</button>
            <p id="player1Status">未准备</p>
        </div>
        <div class="image-wrapper">
            <img src="棋盘.png" alt="准备界面的背景图片">
        </div>
        <div class="player">
            <p>玩家2:</p>
            <button id="player2ReadyBtn">准备</button>
            <p id="player2Status">未准备</p>
        </div>
    </div>

    <script>
let player1Ready = false;
let player2Ready = false;

document.getElementById('player1ReadyBtn').addEventListener('click', () => {
    player1Ready = !player1Ready;
    document.getElementById('player1Status').textContent = player1Ready ? '已准备' : '未准备';
    document.getElementById('player1ReadyBtn').textContent = player1Ready ? '取消准备' : '准备';
    checkAllReady();
});

document.getElementById('player2ReadyBtn').addEventListener('click', () => {
    player2Ready = !player2Ready;
    document.getElementById('player2Status').textContent = player2Ready ? '已准备' : '未准备';
    document.getElementById('player2ReadyBtn').textContent = player2Ready ? '取消准备' : '准备';
    checkAllReady();
});

function checkAllReady() {
    if (player1Ready && player2Ready) {
        // 两个人都准备好了，跳转到下一个界面
        window.location.href = "设置界面.html"; // 替换为你的下一个界面的URL
    }
}
    </script>
</body>
</html>
